<?php

namespace module\manage\validate;

use app\Validate;

class ActivityEnroll extends Validate
{
    /**
     * 所有验证场景需要的字段.
     *
     * @var array<array>
     */
    protected $scene = [
        'read' => ['id'],
        'index' => ['status', 'activity_id', 'page', 'pageSize'],
        'save' => ['activity_id', 'user_id', 'status']
    ];
    /**
     * Get the validation statuss that apply to the request.
     *
     * @var array<string>
     */
    protected $status = [
        'id' => 'require|integer',  // 自增ID
        'activity_id' => 'require|integer|exists:app\model\Activity,id',  // 活动
        'user_id' => 'requireWithout:id|integer',
        'status' => 'requireWithout:id|integer',
        'page' => 'integer|>:0',
        'pageSize' => 'integer|>:0',
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'id' => 'ID',
        'activity_id' => '活动',
        'user_id' => '用户',
        'status' => '状态',
        'page' => '页码',
        'pageSize' => '分页大小',
    ];
}

